<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div class="box">我是文字的内容</div>
  <script>
    //获取元素
    const div = document.querySelector('div')
    //innerText
    div.innerText = `我是更新的内容`
    div.innerText = `<strong>我是更新的内容</strong>`//只将文本内容添加/更新到任意标签位置,不解析标签
    //innerHTML 
    div.innerHTML = `<strong>我是更新的内容</strong>`//会解析标签
  </script>
</body>
</html>